import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FoodVO, FoodForm, FoodQuery } from '@/api/kitchen/food/types';

/**
 * 查询套餐里的美食信息列表
 * @param query
 * @returns {*}
 */

export const listFood = (query?: FoodQuery): AxiosPromise<FoodVO[]> => {
  return request({
    url: '/kitchen/food/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询套餐里的美食信息详细
 * @param id
 */
export const getFood = (id: string | number): AxiosPromise<FoodVO> => {
  return request({
    url: '/kitchen/food/' + id,
    method: 'get'
  });
};

/**
 * 新增套餐里的美食信息
 * @param data
 */
export const addFood = (data: FoodForm) => {
  return request({
    url: '/kitchen/food',
    method: 'post',
    data: data
  });
};

/**
 * 修改套餐里的美食信息
 * @param data
 */
export const updateFood = (data: FoodForm) => {
  return request({
    url: '/kitchen/food',
    method: 'put',
    data: data
  });
};

/**
 * 删除套餐里的美食信息
 * @param id
 */
export const delFood = (id: string | number | Array<string | number>) => {
  return request({
    url: '/kitchen/food/' + id,
    method: 'delete'
  });
};
